export const getObj = (obj: any, value: any, key: string) => {
    const _statusObj: any = obj;
    const res: any[] = [];
    const _sKey = key || "value";
    Object.keys(_statusObj).forEach(_key => {
        if (_statusObj[_key][_sKey] === value) {
            res.push(_statusObj[_key]);
        }
    });
    return res.length <= 1 ? (res[0] ? res[0] : {}) : res;
};
export const USER_LEVEL: any = {
    ADMIN: {
        label: "超级管理员",
        name: "ADMIN",
        value: "1"
    },
    OPERATION_ADMIN: {
        label: "运营人员管理员",
        name: "OPERATION_ADMIN",
        value: "2"
    },
    OPERATION: {
        label: "运营人员",
        name: "OPERATION",
        value: "3"
    },
    REGIONAL_ADMIN: {
        label: "区域人员管理员",
        name: "REGIONAL_ADMIN",
        value: "4"
    },
    REGIONAL: {
        label: "区域人员",
        name: "REGIONAL",
        value: "5"
    },
    TOWN_ADMIN: {
        label: "镇域人员管理员",
        name: "TOWN_ADMIN",
        value: "6"
    },
    TOWN: {
        label: "镇域人员",
        name: "TOWN",
        value: "7"
    },
    VILLAGE_ADMIN: {
        label: "村域人员管理员",
        name: "VILLAGE_ADMIN",
        value: "8"
    },
    VILLAGE: {
        label: "村域人员",
        name: "VILLAGE",
        value: "9"
    },
    VISITOR: {
        label: "游客",
        name: "VISITOR",
        value: "10"
    }
};
export const getUserLevel = (value: any, key?: string) => {
    const _sKey = key || "value";
    return getObj(USER_LEVEL, value, _sKey);
};


export const TASK_MODULE_STATUS: any = {
    DRAFT: {
        value: 0,
        name: "DRAFT",
        label: "草稿",
        type: "info"
    },
    RELEASED: {
        value: 1,
        name: "RELEASED",
        label: "已发布",
        type: "success"
    }
    // REVIEWPENDING: {
    //     value: 2,
    //     name: "REVIEWPENDING",
    //     label: "待审核",
    //     type: ""
    // },
    // RELEASEPENDING: {
    //     value: 3,
    //     name: "RELEASEPENDING",
    //     label: "审核通过",
    //     type: ""
    // },
    // REVIEWFAIL: {
    //     value: 4,
    //     name: "REVIEWFAIL",
    //     label: "审核驳回",
    //     type: ""
    // }
};
export const getTaskModuleStatus = (value: any, key?: string) => {
    const _sKey = key || "value";
    return getObj(TASK_MODULE_STATUS, value, _sKey);
};
